<?php
/**
 * 系统设置
 */
namespace Admin\Controller;
use Admin\Controller\AdminController;
class SystemController extends AdminController {
	//系统设置主页
    public function index(){
        $system=M('system');
        $this->email=$system->where("name='email'")->find();            
        $this->url=$system->where("name='url'")->find();            
        $this->open_register=$system->where("name='open_register'")->find();            
        $this->close_website=$system->where("name='close_website'")->find();            
        $this->close_website_describe=$system->where("name='close_website_describe'")->find();            
        $this->assign("title","系统设置");
    	$this->display();
    }
    //SEO设置
    public function seo(){
        $system=M('system');
        $this->seotitle=$system->where("name='title'")->find();                   
        $this->seokeywords=$system->where("name='keywords'")->find();            
        $this->seodescription=$system->where("name='description'")->find();          
        $this->assign("title","SEO设置");
        $this->display();
    }
    //水印设置
    public function water(){
        $this->assign("title","水印设置");
        $this->display();
    }
    //验证码设置
    public function verify(){
        $this->assign("title","验证码设置");
        $this->display();    	
    }
    //表单处理
    public function handle(){
        $system = M('system');
        foreach (I() as $key => $value) {
            $id = $system->where("name='".$key."'")->find();
            $result = $system->where("id=".$id['id'])->setField('content',$value);
        }  
        $this->success("更新成功");  //.....你懂的
    }
}